package meituanone;

import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/8/30 23:02
 * 小美走公路
 * 未理解题意, 暂时有些问题
 */
public class Main06 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt(); // 站的数量
            int[] pathValue = new int[n];
            for (int i = 0; i < n; i++) {
                pathValue[i] = in.nextInt();
            }
            int start = in.nextInt() - 1; // 起点的索引
            int end = in.nextInt() - 1; // 终点的索引
            if (start == end) {
                System.out.println(0);
                return;
            }
            // 保证 start <= end
            if (start > end) {
                int temp = start;
                start = end;
                end = temp;
            }
            // 记录路径和
            int totalValueA = 0;
            int totalValueB = 0;
            // 第一种路线
            for (int i = start; i < end; i++) {
                totalValueA += pathValue[i];
            }
            // 第二种路线
            for (int i = start; i < n; i++) {
                totalValueB += pathValue[i];
            }
            for (int i = 0; i < end; i++) {
                totalValueB += pathValue[i];
            }
            System.out.println(Math.min(totalValueA, totalValueB));
        }
        in.close();
    }
}
